home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.io.Serializable;
- import javax.swing.event.EventListenerList;
-
- public class Timer implements Serializable {
- protected EventListenerList listenerList = new EventListenerList();
- boolean eventQueued = false;
- int initialDelay;
- int delay;
- boolean repeats = true;
- boolean coalesce = true;
- Runnable doPostEvent = null;
- private static boolean logTimers;
- long expirationTime;
- Timer nextTimer;
- boolean running;
- // $FF: synthetic field
- static Class class$java$awt$event$ActionListener;
-
- public Timer(int var1, ActionListener var2) {
- this.delay = var1;
- this.initialDelay = var1;
- this.doPostEvent = new DoPostEvent(this);
- if (var2 != null) {
- this.addActionListener(var2);
- }
-
- }
-
- // $FF: synthetic method
- static boolean access$0() {
- return logTimers;
- }
-
- public void addActionListener(ActionListener var1) {
- this.listenerList.add(class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")), var1);
- }
-
- synchronized void cancelEvent() {
- this.eventQueued = false;
- }
-
- // $FF: synthetic method
- static Class class$(String var0) {
- try {
- return Class.forName(var0);
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
- }
-
- protected void fireActionPerformed(ActionEvent var1) {
- Object[] var2 = this.listenerList.getListenerList();
-
- for(int var3 = var2.length - 2; var3 >= 0; var3 -= 2) {
- if (var2[var3] == (class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")))) {
- ((ActionListener)var2[var3 + 1]).actionPerformed(var1);
- }
- }
-
- }
-
- public int getDelay() {
- return this.delay;
- }
-
- public int getInitialDelay() {
- return this.initialDelay;
- }
-
- public static boolean getLogTimers() {
- return logTimers;
- }
-
- public boolean isCoalesce() {
- return this.coalesce;
- }
-
- public boolean isRepeats() {
- return this.repeats;
- }
-
- public boolean isRunning() {
- return this.timerQueue().containsTimer(this);
- }
-
- synchronized void post() {
- if (!this.eventQueued) {
- this.eventQueued = true;
- SwingUtilities.invokeLater(this.doPostEvent);
- }
-
- }
-
- public void removeActionListener(ActionListener var1) {
- this.listenerList.remove(class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")), var1);
- }
-
- public void restart() {
- this.stop();
- this.start();
- }
-
- public void setCoalesce(boolean var1) {
- this.coalesce = var1;
- }
-
- public void setDelay(int var1) {
- if (var1 < 0) {
- throw new IllegalArgumentException("Invalid delay: " + var1);
- } else {
- this.delay = var1;
- }
- }
-
- public void setInitialDelay(int var1) {
- if (var1 < 0) {
- throw new IllegalArgumentException("Invalid initial delay: " + var1);
- } else {
- this.initialDelay = var1;
- }
- }
-
- public static void setLogTimers(boolean var0) {
- logTimers = var0;
- }
-
- public void setRepeats(boolean var1) {
- this.repeats = var1;
- }
-
- public void start() {
- this.timerQueue().addTimer(this, System.currentTimeMillis() + (long)this.getInitialDelay());
- }
-
- public void stop() {
- this.timerQueue().removeTimer(this);
- this.cancelEvent();
- }
-
- TimerQueue timerQueue() {
- return TimerQueue.sharedInstance();
- }
- }
-